Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c18n: Miscellaneous improvements #2266

Merged
merged 2 commits into from
Jan 25, 2025
Merged

c18n: Miscellaneous improvements #2266

merged 2 commits into from
Jan 25, 2025

Conversation

dpgao
Copy link
Contributor

@dpgao dpgao commented Dec 11, 2024

Improve trampolines to clear the correct number of return values during tail-call.
Improve previous uses of c18n_return_address.

@dpgao dpgao requested a review from jrtc27 December 11, 2024 12:34
libexec/rtld-elf/rtld_c18n.h Outdated Show resolved Hide resolved
libexec/rtld-elf/aarch64/rtld_c18n_machdep.c Show resolved Hide resolved
libexec/rtld-elf/aarch64/rtld_c18n_asm.S Outdated Show resolved Hide resolved
dpgao added 2 commits January 10, 2025 17:17
Turn all use sites of __builtin_return_address(0) to use the newly
defined rtld_get_return_address macro, which is overridden to take into
account the existence of trampolines when c18n is enabled.
In the following example, bar makes a tail-call to foo, which returns a
value that is observable to the caller of bar, even though bar returns
nothing.

    void *foo();
    void bar() { foo(); }

When bar is called, previous versions of the trampoline clears return
value registers as if foo is being called directly, leaking a
capability. Instead, clear the maximum number of return value registers
as required for both foo and bar.
@bsdjhb bsdjhb merged commit 7d612cb into dev Jan 25, 2025
15 checks passed
@bsdjhb bsdjhb deleted the c18n-retval branch January 25, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants